package com.xiaoye.qbdatahandle.domian;

import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.xiaoye.qbdatahandle.converter.ClearStepConverter;
import com.xiaoye.qbdatahandle.converter.ElementInfoConverter;
import com.xiaoye.qbdatahandle.entity.ClearStepEntity;
import com.xiaoye.qbdatahandle.entity.ImageEntity;
import com.xiaoye.qbdatahandle.result.ElementsVo;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;
import org.springframework.data.mongodb.core.mapping.FieldType;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

/**
 * 专题文章
 *
 * @TableName SUBJECT_ARTICLE
 */
@Data
@ExcelIgnoreUnannotated
@Document(collection = "subject_article")
public class QbSubjectArticle implements Serializable {
    /**
     * 主键
     */
    @Id
    @ExcelProperty("主键")
    private String id;

    /**
     * 标题
     */
    @ExcelProperty("标题")
    @Field(name = "title")
    private String title;

    /**
     * 关键词
     */
    @ExcelProperty("关键词")
    @Field(name = "keywords")
    private String keywords;

    /**
     * 来源
     */
    @ExcelProperty("来源")
    @Field(name = "source")
    private String source;
    /**
     * 原文链接
     */
    @ExcelProperty("原文链接")
    @Field(name = "url")
    private String url;
    /**
     * 发布时间
     */
    @ExcelProperty("发布时间")
    @Field(name = "publish_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private String publishTime;

    /**
     * 简介
     */
    @ExcelProperty("简介")
    @Field(name = "intro")
    private String intro;

    /**
     * 内容
     */
    @ExcelProperty("内容")
    @Field(name = "content")
    private String content;
    /**
     * 图片
     */
    @Field(name = "images", targetType = FieldType.ARRAY)
    private List<ImageEntity> images;

    @ExcelProperty("正文图片")
    private String contentImages;
    /**
     * 创建时间
     */
    @ExcelProperty("创建时间")
    @Field(value = "create_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private String createTime;

    /**
     * 更新时间
     */
    @ExcelProperty("更新时间")
    @Field(value = "update_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private String updateTime;

    /**
     * 封面
     */
    @ExcelProperty("封面")
    @Field(name = "cover")
    private String cover;

    /**
     * 备注
     */
    @ExcelProperty("备注")
    @Field(name = "remark")
    private String remark;
    /**
     * 采集结果id
     */
    @Field(name = "collect_result_id")
    private String collectionResultId;

    /**
     * 要素信息
     */
    @ExcelProperty(value = "要素信息", converter = ElementInfoConverter.class)
    @Field(name = "element_info")
    private ElementsVo elementInfo;
    /**
     * 操作过程
     */
    @ExcelProperty(value = "操作过程", converter = ClearStepConverter.class)
    @Field(name = "clear_step")
    private ClearStepEntity clearStep;
    /**
     * 任务id
     */
    @ExcelProperty("任务id")
    @Field(name = "_tid", targetType = FieldType.OBJECT_ID)
    private String tid;
    private static final long serialVersionUID = 1L;


}